;;; $Id: cvty.scm,v 1.1 1999/07/08 13:27:42 davidp Exp $
;;;
;;; For the cvty class, the only functions directly implemented via
;;; C++ are the basic ones such as cvty:convex etc. This macro takes
;;; the tedium out of supplying the others.
;;;
;;; Author: DAP

;;; This macro simply expands (def-cvty-fn convex mixed) into
;;; (define (cvty:convex-mixed arg) (and (cvty:convex arg) (cvty:mixed arg)))
;;; Neither pretty nor efficient, but handy enough.

(define-macro (def-cvty-fn . types)
  `(define (,(string->symbol
	      (apply string-append
		    "cvty:" (cdr (apply append (map (lambda (x) `("-" ,(format #f "~a" x))) types)))))
	    arg)
     (and ,@(map (lambda (x) `(,(string->symbol (format #f "cvty:~a" x)) arg)) types))))

;;; Now here they go...

(def-cvty-fn convex mixed)
(def-cvty-fn concave mixed)
(def-cvty-fn tangent convex)
(def-cvty-fn tangent concave)
(def-cvty-fn tangent mixed)
(def-cvty-fn tangent convex mixed)
(def-cvty-fn tangent concave mixed)
(def-cvty-fn tangent inflect)
(def-cvty-fn tangent inflect convex)
(def-cvty-fn tangent inflect concave)
(def-cvty-fn tangent inflect mixed)
(def-cvty-fn tangent inflect convex mixed)
(def-cvty-fn tangent inflect concave mixed)
(def-cvty-fn knife convex)
(def-cvty-fn knife concave)
(def-cvty-fn knife mixed)
(def-cvty-fn knife convex mixed)
(def-cvty-fn knife concave mixed)
